package dev.ece.suit.hexmap;

import java.util.List;

import dev.ece.util.lib.Vector2f;
import dev.ece.util.lib.Vector3f;

public interface MapCellCreator {

	public int getCircles();
	
	public float getCellOutSize();

	public float getCellInSize();

	public float getWaterSize();
	
	public int count();
	
	public Vector2f[][] getBlendUV();
	
	public Vector2f getCenteruv();
	
	public MapCell createMapCell(int terrainIndex, int index, int row, int col);
	
	public void fillData(MapCell cell, List<Vector3f> vertice, List<Vector2f> uv, List<Vector3f> normals, List<Vector2f> blenduv);
	
	public void destroy();
	
	public static Vector3f addNormal(Vector3f result, Vector3f normal) {
		result.add(normal);
		result.normalize();
		return result;
	}
	
	public static Vector3f createNormal(Vector3f result, Vector3f normal) {
		if(result == null) {
			return new Vector3f(normal);
		} else {
			return addNormal(result, normal);
		}
	}
	
	public static Vector3f createVertex(Vector3f vertex, float height) {
		return new Vector3f(vertex.getX(), height, vertex.getZ());
	}
	
	public static Vector3f[][] clone(Vector3f[][] o, float[][] heights) {
		Vector3f[][] result = new Vector3f[o.length][];
		Vector3f[] cols = null;
		for(int row = 0; row<o.length; row ++) {
			cols = o[row];
			result[row] = new Vector3f[cols.length];
			for(int col = 0; col<cols.length; col ++) {
				result[row][col] = new Vector3f(o[row][col]);
				result[row][col].setY(heights[row][col]);
			}
		}
		return result;
	}
	
	public static Vector3f[][] clone(Vector3f[][] o) {
		Vector3f[][] result = new Vector3f[o.length][];
		Vector3f[] cols = null;
		for(int row = 0; row<o.length; row ++) {
			cols = o[row];
			result[row] = new Vector3f[cols.length];
			for(int col = 0; col<cols.length; col ++) {
				result[row][col] = new Vector3f(o[row][col]);
			}
		}
		return result;
	}
	
	public static Vector2f[][] clone(Vector2f[][] o) {
		Vector2f[][] result = new Vector2f[o.length][];
		Vector2f[] cols = null;
		for(int row = 0; row<o.length; row ++) {
			cols = o[row];
			result[row] = new Vector2f[cols.length];
			for(int col = 0; col<cols.length; col ++) {
				result[row][col] = new Vector2f(o[row][col]);
			}
		}
		return result;
	}
	
}
